<?php
declare(strict_types=1);

namespace App\Site\Rpc;

use App\Site\Contract\MenuServiceInterface;
use App\Site\Service\SitePublicMenuService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\RpcMultiplex\Constant;
use Hyperf\RpcServer\Annotation\RpcService;

#[RpcService(name: "MenuService", server: "rpc", protocol: Constant::PROTOCOL_DEFAULT)]
class MenuService implements MenuServiceInterface
{
    #[Inject]
    protected SitePublicMenuService $sitePublicMenuService;

    public function getList(): array
    {
        return $this->sitePublicMenuService->getMenuList();
    }

    public function getTree(array $params = []): array
    {
        $params['mode'] = 2;
        return $this->sitePublicMenuService->getTree($params);
    }

    public function getSuperAdminRouters(): array
    {
        return $this->sitePublicMenuService->getSuperAdminRouters();
    }

    public function getRoutersByIds(array $ids): array
    {
        return $this->sitePublicMenuService->getRoutersByIds($ids);
    }
}